#include "Blocks/CrossbowBlock.h"

namespace PocketSurvival
{

    int32_t CrossbowBlock::getDamage(int32_t value)
    {
        return (Terrain::ExtractData(value) >> 8) & 0xFF;
    }

    int32_t CrossbowBlock::setDamage(int32_t value, int32_t damage)
    {
        int32_t num = Terrain::ExtractData(value);
        num &= -65281;
        num |= MathUtils::Clamp<int32_t>(damage, 0, 255) << 8;
        return Terrain::ReplaceData(value, num);
    }

    int32_t CrossbowBlock::getIndex()
    {
        return Index();
    }
    const std::string &CrossbowBlock::getBlockName()
    {
        static std::string blockName = "CrossbowBlock";
        return blockName;
    }
}